home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / C / SQRT.ZIP / SQRT.DOC < prev   
Encoding:
Text File  |  1996-03-11  |  1.2 KB  |  46 lines

  1.               -----  Fast Square Root Doc by Noble Roman  ----- 
  2.  
  3.      Ok, if you studied calculus you might already know this but
  4. lets say you need that square root of 23, and you have no
  5. calulator and you really need the answer.  So you make
  6.                
  7.     f(x) = √x
  8.  
  9.     According to some differientation rules you take f(x) and add it
  10.     to the derivative of f(x)  [ which is f'(x) ] and multiply it by
  11.     by dx.  dx is the difference between x and some normal square
  12.     close to x.
  13.  
  14.          dx
  15.     √x + ---
  16.          2√x
  17.  
  18.     From this you you get a very close answer to the real one.
  19.  
  20.     Lets do and example.
  21.  
  22.     √34    36 is close to 34 and I know the square root of it
  23.               which is 6.  
  24.               So dx=x-36 which is -2
  25.               dx=-2
  26.  
  27.            -2
  28.     √36 + ----
  29.           2√36
  30.          1
  31.     6 -  -
  32.          6                
  33.                           5      35
  34.     √34 is approxamitly  5-  =  ---  =  5.83333
  35.                           6      6
  36.     The Square root of 34 is really 5.83092, pretty close eh.
  37.  
  38.  
  39.     For more help or info, contact me at
  40.     thomas@unix.cde.com
  41.  
  42.  
  43.      p.s.
  44.           if you need some help on fixed point math, right me
  45.           and I will make a doc on that also.
  46.